package com.pauldada.sakurabbs.services;

import com.pauldada.sakurabbs.dao.UserAccountRepository;
import com.pauldada.sakurabbs.entities.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserAccountService {
    @Autowired
    UserAccountRepository userAccountRepository;      //装配接入层

    public UserAccount save(UserAccount userAccount){
        return userAccountRepository.save(userAccount);
    }

    public List<UserAccount> getAll(){
        return userAccountRepository.findAll();
    }

    public UserAccount findByUsername(String username){
        return userAccountRepository.findByUsername(username);
    }

    public UserAccount findByUserId(long id){
        return userAccountRepository.findByUserId(id);
    }
}
